//
//  GRStageDetailTableViewCell.m
//  YC_GRice
//
//  Created by luojinrong11 on 2018/7/21.
//  Copyright © 2018年 YeCai. All rights reserved.
//

#import "GRStageDetailTableViewCell.h"

@implementation GRStageDetailTableViewCell

-(void)setLeftArr:(NSArray *)leftArr{
    _leftArr = leftArr;
    for (int i = 0 ; i <4; i++) {
        UILabel * label = [self.contentView viewWithTag:i+100];
        if (i <leftArr.count) {
            label.hidden = NO;
            label.text = self.leftArr[i];
        }else{
           label.hidden = YES;
        }
    }
}

-(void)setCellType:(StageCellType)cellType{
    _cellType = cellType;
    if (cellType == StageCellTypeInvoice) {
        self.invoiceBt.hidden = NO;
        self.leftOffset.constant = 10;
        self.titleLabel.text = @"发票";
    }else{
        self.invoiceBt.hidden = YES;
        if(cellType == StageCellTypeDetail){
        self.leftOffset.constant = 58;
        self.titleLabel.text = @"订单信息";
    }else{
          self.titleLabel.text = @"分期详情";
        self.leftOffset.constant = 10;
    }
    }
        
}

-(void)setRightArr:(NSArray *)rightArr{
    _rightArr = rightArr;
    if (rightArr.count == 2) {
        self.contentHeight.constant = 65;
    }else{
        self.contentHeight.constant = 116;
    }
    for (int i = 0 ; i <4; i++) {
         UILabel * label = [self.contentView viewWithTag:i+1000];
        if (i <_rightArr.count) {
            label.hidden = NO;
            label.text = self.rightArr[i];
        }else{
            label.hidden = YES;
        }
    }
}

- (IBAction)copyAction:(id)sender {
    if (_cellType == StageCellTypeDetail) {
        UIPasteboard * pastboard = [UIPasteboard generalPasteboard];
        pastboard.string = [self.rightArr firstObject];
        [GRHUD showMessage:@"复制成功"];
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    [self.invoiceBt.layer setBorderWidth:1];
    [self.invoiceBt.layer setBorderColor:HEXCOLOR(0xDDDDDD).CGColor];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
